package com.zyz.M_File和IO流.IO流.对象流;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * @author: vick
 * @Date: 2025/4/10
 * @Description:
 * @version: 1.0
 */
//反序列化
public class PersonRead {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        File file = new File("person.dat");
        FileInputStream fileInputStream = new FileInputStream(file);
        ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
        Person object = (Person)objectInputStream.readObject();
        objectInputStream.close();
        fileInputStream.close();
        System.out.println(object);
    }
}
